<style lang="scss">
/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
@import 'uview-ui/index.scss';
</style>
<script>
// global.reqHeard = 'http://192.168.110.74:8106'; //本地环境
// global.reqHeard = 'http://127.0.0.1:8106'; //本地环境127
// global.reqHeard = 'http://61.132.67.157:18287'; //测试环境
// global.reqHeard = 'http://61.132.67.157:28287'; //2024年3月13日 喻荣浩
global.reqHeard = 'http://61.132.67.157:8287'; //客户环境 生产地址

// global.wsUrl = 'ws://192.168.0.74:8106'; //本地环境
// global.wsUrl = 'ws://127.0.0.1:8106'; //本地环境127
// global.wsUrl = 'ws://61.132.67.157:18287'; //测试环境
// global.wsUrl = 'ws://61.132.67.157:28287'; //2024年3月13日 喻荣浩
global.wsUrl = 'ws://61.132.67.157:8287'; //生产环境

// apk包名	yunding-out.apk
export default {
  globalData: {
    deviceId: null,
  },
  onLaunch: function () {
    var that = this;
    uni.onSocketOpen(function (res) {
      console.log('WebSocket连接已打开！');
    });

    uni.onSocketMessage(function (res) {
      const param = JSON.parse(res.data);
      uni.showModal({
        title: '通知',
        content: param.obj,
        cancelText: '知道了',
        confirmText: '去看看',
        success: function (res) {
          if (res.confirm) {
            uni.navigateTo({
              url: '/pages/index/notice',
            });
          }
        },
      });
    });
  },
  onShow: function () {
    console.log('App Show');
    // this.getAPPInfo();
  },
  onHide: function () {
    console.log('App Hide');
  },
  methods: {
    getAPPInfo() {
      console.log('轮循更新');
      // 不是生产环境 不更新
      if (global.reqHeard !== 'http://61.132.67.157:8287') return false;
      let that = this;
      this.$u.post('/auth/appInfo', {}).then((res) => {
        that.downUrl = `${global.reqHeard}/file/${res.data.appPath}`;
        var appversion = plus.runtime.version;
        console.log('版本号:', appversion);
        console.log('版本号:', res.data.appVersion);
        if (appversion != res.data.appVersion) {
          uni.reLaunch({
            url: '/pages/index/upload',
          });
        } else {
          setTimeout(function () {
            that.getAPPInfo();
          }, 1000 * 60 * 2);
        }
      });
    },
  },
};
</script>

<style lang="scss">
@import url('static/css/iconfont.css');

page {
  font-size: 35rpx;
}

.content {
  padding-bottom: 80rpx;
}

.col-000 {
  color: #000;
}

.col-333 {
  color: #333;
}

.col-555 {
  color: #555;
}

.col-777 {
  color: #777;
}

.col-999 {
  color: #999;
}

.col-btn {
  color: #003db8;
}

.pd-15 {
  padding: 15rpx;
}

.m-t-25 {
  margin-top: 25rpx;
}

.m-t-35 {
  margin-top: 35rpx;
}

.m-t-55 {
  margin-top: 55rpx;
}

.m-b-25 {
  margin-bottom: 25rpx;
}

.m-b-35 {
  margin-bottom: 35rpx;
}

.m-b-55 {
  margin-bottom: 55rpx;
}

.m-l-5 {
  margin-left: 5rpx;
}

.m-l-10 {
  margin-left: 10rpx;
}

.m-l-15 {
  margin-left: 15rpx;
}

.m-l-25 {
  margin-left: 25rpx;
}

.m-r-5 {
  margin-right: 5rpx;
}

.m-r-10 {
  margin-right: 10rpx;
}

.m-r-15 {
  margin-right: 15rpx;
}

.m-r-25 {
  margin-right: 25rpx;
}

.cantClick {
  pointer-events: none;
}

.line-1 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  word-break: break-all;
  white-space: normal !important;
}

.line-view {
  width: 100%;
  display: flex;
  align-items: flex-start;
  padding: 10rpx 0;
  .line-text {
    width: 200rpx;
    font-weight: 700;
    color: #555;
  }

  .line-value {
    width: 500rpx;
    display: flex;
    color: #6a6a6a;
  }
}

// 被选中元素阴影
.checkView {
  // border: 2rpx solid #cdcdcd;
  box-sizing: border-box;
  // box-shadow: 5rpx 8rpx 15rpx #c9c9c9;
}

.noData {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 80rpx;
}

.btn-view {
  margin-top: 35rpx;
  width: 80%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pagination-view {
  z-index: 999;
  width: 750rpx;
  position: fixed;
  bottom: 0;
  left: 0;
  background-color: #fff;
  padding: 15rpx;
  border-top: 1rpx solid #f8f8f8;
}
</style>
